<#import "/macro.ftl" as m>
<@m.page_header title='注册统计' />
<div id="page-content-wrapper">
    <div id="page-title">
        <h3>注册统计</h3>
    </div>
    <div id="page-content">
    	<div class="row">
    		<div class="col-md-5">
    			<#if searchCategory == "TODAY">
                		<#assign todayClass="bg-blue" />
                		<#assign yestodayClass="font-blue" />
                		<#assign latest7dayClass="font-blue" />
                		<#assign latest30dayClass="font-blue" />
                		<#assign allClass="font-blue" />
                	<#elseif searchCategory == "YESTODAY">
                		<#assign todayClass="font-blue" />
                		<#assign yestodayClass="bg-blue" />
                		<#assign latest7dayClass="font-blue" />
                		<#assign latest30dayClass="font-blue" />
                		<#assign allClass="font-blue" />
                	<#elseif searchCategory == "LATEST7DAY">
                		<#assign todayClass="font-blue" />
                		<#assign yestodayClass="font-blue" />
                		<#assign latest7dayClass="bg-blue" />
                		<#assign latest30dayClass="font-blue" />
                		<#assign allClass="font-blue" />
                	<#elseif searchCategory == "LATEST30DAY">
                		<#assign todayClass="font-blue" />
                		<#assign yestodayClass="font-blue" />
                		<#assign latest7dayClass="font-blue" />
                		<#assign latest30dayClass="bg-blue" />
                		<#assign allClass="font-blue" />
                	<#elseif searchCategory == "ALL">
                		<#assign todayClass="font-blue" />
                		<#assign yestodayClass="font-blue" />
                		<#assign latest7dayClass="font-blue" />
                		<#assign latest30dayClass="font-blue" />
                		<#assign allClass="bg-blue" />
                	<#else>
                		<#assign todayClass="font-blue" />
                		<#assign yestodayClass="font-blue" />
                		<#assign latest7dayClass="font-blue" />
                		<#assign latest30dayClass="font-blue" />
                		<#assign allClass="font-blue" />	
                	</#if>
    			<a href="/channelstatistic/register?searchCategory=TODAY&startDate=${today}&endDate=${today}" class="btn large radius-all-4 ${todayClass}">
		            <span class="button-content">今天</span>
                </a>
                <a href="/channelstatistic/register?searchCategory=YESTODAY&startDate=${yesterday}&endDate=${yesterday}" class="btn large radius-all-4 ${yestodayClass}">
		            <span class="button-content">昨天</span>
                </a>
                <a href="/channelstatistic/register?searchCategory=LATEST7DAY&startDate=${day7}&endDate=${today}" class="btn large radius-all-4 ${latest7dayClass}">
		            <span class="button-content">最近7天</span>
                </a>
                <a href="/channelstatistic/register?searchCategory=LATEST30DAY&startDate=${day30}&endDate=${today}" class="btn large radius-all-4 ${latest30dayClass}">
		            <span class="button-content">最近30天</span>
                </a>
                <a href="/channelstatistic/register?searchCategory=ALL&startDate=2014-1-1&endDate=${today}" class="btn large radius-all-4 ${allClass}">
		            <span class="button-content">全部</span>
                </a>
    		</div>
    		<form action="/channelstatistic/register" method="get">
	    		<div class="form-input col-md-6">
	                <div class="row">
	                	<div class="col-md-3">
	                        <input id="startDate" placeholder="统计从" type="text" name="startDate" value="${startDate?string('yyyy-MM-dd')}" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
	                    </div>
	                    <div class="col-md-3">
	                        <input id="endDate" placeholder="到" type="text" name="endDate" value="${endDate?string('yyyy-MM-dd')}" onClick="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd'})">
	                    </div>
	                    <div class="col-md-4">
	                        <input id="name" placeholder="填写渠道名称查询" type="text" name="name" value="${name}">
	                    </div>
	                    <div class="col-md-1">
	                        <a href="javascript:;" class="btn large primary-bg radius-all-4" id="search" title="Validate!" onclick="$('form').submit();">
					            <span class="button-content">
					                查询
					            </span>
			                </a>
	                    </div>
	                </div>
	            </div>
            </form>
    	</div>
    	<#if channelStatistics.list?size gt 0 >
	    	<table class="table mrg10T">
		        <thead>
		            <tr>
		            	<th>渠道 <br />渠道号</th>
		                <th>注册数</th>
		                <th>实名认证数</th>
		                <th>成功交易用户数</th>
		                <th>交易订单数</th>
		                <th>成功交易订单数</th>
		                <th>成功交易金额</th>
		                <th>操作</th>
		            </tr>
		        </thead>
		        <tbody>
		        	<#list channelStatistics.list as statistic>
		        	<tr>
		        		<td class="font-size-17">${statistic.channel.name}<br />${statistic.channel.number}</td>
		                <td class="font-size-17">${statistic.registerCount}</td>
		                <td class="font-size-17">${statistic.realNameCount}</td>
		                <td class="font-size-17">${statistic.paidUserCount}</td>
		                <td class="font-size-17">${statistic.orderCount}</td>
		                <td class="font-size-17">${statistic.paidOrderCount}</td>
		                <td class="font-size-17">${statistic.paymentAmount?string('#,##0.00')}</td>
		                <td class="font-size-17">
		                	<a href="/channels/analyse?popularizeId=${statistic.popularizeId}&<#if statistic.popularizeId?? == false>number=${statistic.channel.number}&</#if>startDate=${startDate?string('yyyy-MM-dd')}&endDate=${endDate?string('yyyy-MM-dd')}" class="btn medium primary-bg radius-all-4" id="search" title="Validate!" onclick="analyseByDate();">
					            <span class="button-content">分析</span>
			                </a>
		                </td>
		            </tr>
		            </#list>
		    	</tbody>
		    </table>
		    <div class="button-group center-div">
		    	${pagerHelper.content}
		    </div>
    	<#else>
    		<div class="row">
    			<div class="col-md-12 text-center pad25T">
    				<h1>当前时段无注册用户</h1>
    			</div>
    		</div>
    	</#if>
    </div>
</div>